const https = require('https')
const http = require('http')
//  我们可使用cheerio 插件帮助我们将爬墙的内容转为虚拟dom
 const cheerio = require('cheerio')
const { createProxyMiddleware } = require("http-proxy-middleware")
const url = require('url')
const logger = require('../../log')
const server = http.createServer((req, res) => {
    let data = ''
    https.get('https://www.jd.com/', (result) => {
        result.on('data', (chunk) => {
            data +=chunk
        })
        result.on('end', () => { 
            // logger.debug(data)
            filterData(data)
            // res.end()
        })
    })
})
function filterData(data){
    const $ = cheerio.load(data)
    console.log($('.link-login').html());
}
server.listen('3000', () => {
    console.log('q');
})
